package com.hnnou.freshmenappserver.dao;

import com.hnnou.freshmenappserver.bean.Message;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface MessageDao {
    @Select("select * from t_message")
    List<Message> findAll();
    @Delete("delete from t_message where id=#{id}")
    int deleteById(int id);
    @Update("update t_message set title=#{title} ,content=#{content} ,date=#{date}" +
            " where id=#{id}")
    int update(Message message);
    @Insert("insert into t_message(foodid,userid,message,postdate)"+
            " values(#{foodid},#{userid},#{message},#{postdate})")
    int insert(Message message);

    @Select("select * from t_message where id=#{id}")
    Message selectById(int id);

}
